package com.ruoyi.yl.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.yl.domain.YlStockOut;
import com.ruoyi.yl.mapper.YlStockOutMapper;
import com.ruoyi.yl.service.IYlStockOutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Author: linKe
 * @Date: 2022/2/21 17:09
 * @FileName: YlStockOutServiceImpl
 * @version: 1.0
 * @Description: 出库信息Service业务层处理
 */
@Service
public class YlStockOutServiceImpl implements IYlStockOutService
{
    @Autowired
    private YlStockOutMapper ylStockOutMapper;

    /**
     * 查询出库信息
     *
     * @param id 出库信息主键
     * @return 出库信息
     */
    @Override
    public YlStockOut selectYlStockOutById(Long id)
    {
        return ylStockOutMapper.selectYlStockOutById(id);
    }

    /**
     * 查询出库信息列表
     *
     * @param ylStockOut 出库信息
     * @return 出库信息
     */
    @Override
    public List<YlStockOut> selectYlStockOutList(YlStockOut ylStockOut)
    {
        return ylStockOutMapper.selectYlStockOutList(ylStockOut);
    }

    /**
     * 新增出库信息
     *
     * @param ylStockOut 出库信息
     * @return 结果
     */
    @Override
    public int insertYlStockOut(YlStockOut ylStockOut)
    {

        ylStockOut.setCreateTime(LocalDateTime.now());
        return ylStockOutMapper.insertYlStockOut(ylStockOut);
    }

    /**
     * 修改出库信息
     *
     * @param ylStockOut 出库信息
     * @return 结果
     */
    @Override
    public int updateYlStockOut(YlStockOut ylStockOut)
    {
        ylStockOut.setUpdateTime(LocalDateTime.now());
        return ylStockOutMapper.updateYlStockOut(ylStockOut);
    }

    /**
     * 批量删除出库信息
     *
     * @param ids 需要删除的出库信息主键
     * @return 结果
     */
    @Override
    public int deleteYlStockOutByIds(Long[] ids)
    {
        return ylStockOutMapper.deleteYlStockOutByIds(ids);
    }

    /**
     * 删除出库信息信息
     *
     * @param id 出库信息主键
     * @return 结果
     */
    @Override
    public int deleteYlStockOutById(Long id)
    {
        return ylStockOutMapper.deleteYlStockOutById(id);
    }
}
